package com.timothy.business.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.timothy.business.model.ResultMessage;
import com.timothy.business.model.SysMenuEntity;
import com.timothy.business.service.UserService;
import com.timothy.business.util.ResultMessageHelper;

@RestController
@RequestMapping("/sys/menu")
public class SysMenuController extends AbstractController {

	@Autowired
	private UserService userService;

	/**
	 * 用户菜单列表
	 */
	@RequestMapping("/user")
	public ResultMessage<List<SysMenuEntity>> user() {
		int userId = this.getUserId();
		List<SysMenuEntity> menuList = userService.getUserMenuList(userId);
		return ResultMessageHelper.successResult(menuList);
	}

}
